<template>
	<view style="background-color: #F8F8F8; overflow-x: hidden;">
		<view class="nav-back">
			<top-heigth :backTitle="backTitle"></top-heigth>
		</view>
			
		
		<view class="content-box">
			<view class="notice2-list" v-for="item in list">
				<view class="notice-list-l">
					<view class=""><b>{{item.messageTitle}}</b></view>
					<view class="font-hui">{{item.createTime}}</view>
				</view>
				<view class="font">
					{{item.messageContent}}
				</view>
			</view>
			<view class="notice2-list" v-for="item in list2">
				<view class="notice-list-l">
					<view class=""><b>{{item.templateMessageTitle}}</b></view>
					<view class="font-hui">{{item.createTime}}</view>
				</view>
				<view class="font">
					{{item.templateMessageContent}}
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	import TopHeigth from '@/components/TopHeigth.vue'
	
	export default {
		data() {
			return {
				backTitle:"系统消息",
				list: [],
				list2: [],
			}
		},
		components: { TopHeigth },
		onLoad() {
			this.getList();
			this.getNowTime()
			
		},
		methods: {
			getList(){
				uni.$u.http.post('/api/shop/v1_0/tAppMessageSendRCA/queryTAppMessageSend',{
					sendTypes:[0,2],
				}).then((res) => {
					this.list = res.aaData
				})
				uni.$u.http.post('/api/shop/v1_0/tAppMessageTemplateRCA/queryTAppMessageTemplate',{}).then((res) => {
					this.list2 = res.aaData
				}) 
			},
			 //获取当前时间
			      getNowTime() {
			        var date = new Date();
			        //年 getFullYear()：四位数字返回年份
			        var year = date.getFullYear(); //getFullYear()代替getYear()
			        //月 getMonth()：0 ~ 11
			        var month = date.getMonth() + 1;
			        //日 getDate()：(1 ~ 31)
			        var day = date.getDate();
			        //时 getHours()：(0 ~ 23)
			        var hour = date.getHours();
			        //分 getMinutes()： (0 ~ 59)
			        var minute = date.getMinutes();
			        //秒 getSeconds()：(0 ~ 59)
			        var second = date.getSeconds();
			        var time = year + '-' + this.addZero(month) + '-' + this.addZero(day) + ' ' + this.addZero(hour) + ":" +this.addZero(minute) + ':' + this.addZero(second);
						uni.setStorageSync('ismessagetime', time);
						console.log('用户点击取消',time);
			        },
			        //小于10的拼接上0字符串
			        addZero(s) {
			            return s < 10 ? ('0' + s) : s;
			        },
		}
	}
</script>

<style lang="scss" scoped>
	@mixin flex($direction: row) {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: $direction;
	}
	.uv-nav-slot {
		@include flex;
		align-items: center;
		justify-content: space-between;
		border-width: 0.5px;
		border-radius: 100px;
		border-color: #dadbde;
		padding: 3px 7px;
		opacity: 0.8;
	}
	
	.notice2-list{
		background-color: #fff;
		border-radius: 24rpx;
		padding: 32rpx 24rpx;
		margin-top: 24rpx;
		.notice-list-l{
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 30rpx;
			color: #333;
		}
		.font{
			color: #666;
			font-size: 26rpx;
			margin-top: 16rpx;
		}
	}
	
</style>
